﻿@typeparam T
@inject IStringLocalizerAsync<AuthorizedToken<T>> Localizer
<AuthorizeView Policy="@SharedConstants.WRITERPOLICY">
    <Authorized>
        <div class="btn-group">
            <InputText id="@Name" class="form-control" @bind-Value="_token.ValueString" />
            @if (QuickValues is not null)
            {
                <button type="button" class="btn btn-primary dropdown-toggle dropdown-toggle-split" data-bs-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
                    <span class="visually-hidden">Toggle Dropdown</span>
                </button>
                <div class="dropdown-menu dropdown-menu-right">
                    @foreach (var kv in QuickValues)
                    {
                        <button type="button" class="dropdown-item" @onclick="() => SetValue(kv.Value)">@Localizer[kv.Key]</button>
                    }
                </div>
            }
        </div>
    </Authorized>
    <NotAuthorized>
        @_token.ValueString
    </NotAuthorized>
</AuthorizeView>

